#!/bin/bash

# user: zzy
# passwd: 1
# uid: 1001

COLOR_BEGIN="\033[33m"
COLOR_END="\033[0m"

function help() {
	name=$(basename $0)
	echo -e "${COLOR_BEGIN}usage: ./$name <parameter>${COLOR_END}"
	echo -e "${COLOR_BEGIN}support parameters: empty, help${COLOR_END}"
	echo -e "${COLOR_BEGIN}./$name => run --rm with user${COLOR_END}"
	echo -e "${COLOR_BEGIN}./$name edit => run with user${COLOR_END}"
	echo -e "${COLOR_BEGIN}./$name help => help${COLOR_END}"
}

# pull first
sudo docker pull ft2team/x86_2404

if [ $# -lt 1 ]; then # if no parameter, run --rm with user
	sudo docker run --rm --privileged=true -v ~/:/mnt -it ft2team/x86_2404
	exit 0
fi

if [ $1 == 'help' ]; then
	help
	exit 0
fi

if [ $1 == 'edit' ]; then
	sudo docker run --privileged=true -v ~/:/mnt -it ft2team/x86_2404
	exit 0
fi

help
